function postHttp(url, data, cb) {
  wx.request({
    url: rootDocment + url,
    data: data,
    method: 'post',
    header: { 'Content-Type': 'application/json' },
    success: function (res) {
      return typeof cb == "function" && cb(res.data)
    }, 
    fail: function () { 
      return typeof cb == "function" && cb(false) 
    } 
  })    
} 
var rootDocment = 'https://swcj.majiangyun.com/wechat';
// var rootDocment = 'http://localhost:8781/wechat';
  
function getHttp(url, data, cb) {
  wx.request({
    url: rootDocment + url,
    data: data,
    method: 'get',
    header: { 'Content-Type': 'application/x-www-form-urlencoded' },
    success: function (res) {
      return typeof cb == "function" && cb(res.data)
    },
    fail: function () {
      return typeof cb == "function" && cb(false)
    }
  })
}
module.exports = {
  postHttp: postHttp,
  getHttp: getHttp

}